package com.shop.controller;


import com.shop.entity.SupplierCouriers;
import com.shop.model.PageParam;
import com.shop.model.vo.Rsp;
import com.shop.service.SupplierCouriersService;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 骑手 yyt(SupplierCouriers)表控制层
 *
 * @author makejava
 * @since 2020-11-21 10:12:53
 */
@Validated
@RestController
@RequestMapping("couriers")
@AllArgsConstructor
public class SupplierCouriersController {
    /**
     * 服务对象
     */
    private final SupplierCouriersService supplierCouriersService;
    /**
     * @author clh
     * @description 增
     * @date  2020/11/27 16:28
     * @param supplierCouriers
     * @param userId
     * @return {@link Rsp}
     **/
    @PostMapping("insertSelective")
    public Rsp insertSelective(@RequestBody SupplierCouriers supplierCouriers,
                               @RequestHeader Integer userId){
        System.out.println(supplierCouriers);
        return supplierCouriersService.insertSelective(supplierCouriers,userId);
    }
    /**
     * @author clh
     * @description 改
     * @date  2020/11/27 16:29
     * @param supplierCouriers
     * @param userId
     * @return {@link Rsp}
     **/
    @PostMapping("updateById")
    public Rsp updateById(@RequestBody SupplierCouriers supplierCouriers,
                          @RequestHeader Integer userId){

        return supplierCouriersService.updateById(supplierCouriers,userId);
    }
    /**
     * @author clh
     * @description 删
     * @date  2020/11/27 16:31
     * @param supplierCouriers
     * @return {@link Rsp}
     **/
    @PostMapping("deleteById")
    public Rsp deleteById(@RequestBody SupplierCouriers supplierCouriers){

        return supplierCouriersService.deleteById(supplierCouriers);
    }
    /**
     * @author clh
     * @description 分页 模糊查询
     * @date  2020/11/27 16:32
     * @param pageParam
     * @return {@link Rsp}
     **/
    @PostMapping("searchSomeByPage")
    public Rsp searchSomeByPage(@RequestBody PageParam<SupplierCouriers> pageParam){

        return Rsp.success(supplierCouriersService.searchSomeByPage(pageParam));
    }
}